# AUTHOR: DING
# -*- codeing = utf-8 -*-
# @Time: 2024/2/26 18:57
# @Author: 86139
# @Site: 
# @File: 17-L1Loss.py
# @Software: PyCharm
# tensorboard --logdir=pytorch/logs --port=6007
import torch
from torch import nn

loss = nn.L1Loss()
mse = nn.MSELoss()

input = torch.randn(3, 2)
target = torch.randn(3, 2)
output = loss(input, target)
output2 = mse(input, target)
# print(input)
# print(target)
print(output)
print(output2)

x = torch.tensor([0.1, 0.2, 0.3])
x = torch.reshape(x, [1, 3])
target = torch.tensor([1])
loss_cross = nn.CrossEntropyLoss()
res = loss_cross(x,target)
print(res)
